package com.sh.caryr.erp.service.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.sh.caryr.erp.entity.stock.Sku;
import com.sh.caryr.erp.entity.stock.Storage;
import com.sh.caryr.erp.mapper.StorageMapper;
import com.sh.caryr.erp.service.IStorageService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 仓库表 服务实现类
 * </p>
 *
 * @author milkeeper
 * @since 2017-11-22
 */
@Service
public class StorageServiceImpl extends ServiceImpl<StorageMapper, Storage> implements IStorageService {

    @Override
    public List<Storage> findEnittyDynamic(Integer current, Integer size, Wrapper wrapper, String orderBy) {
        wrapper.orderBy(orderBy);
        List<Storage> entities;
        if (size != null) {
            Page<Storage> page = new Page<>(current, size);
            entities = this.selectPage(page, wrapper).getRecords();
        } else {
            entities = this.selectList(wrapper);
        }
        return entities;
    }
}
